package net.huashitong.Indicators.service;

import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sirdc.modules.utils.NumberUtils;
import net.huashitong.Indicators.databean.CompletionClassificationDatabean;
import net.huashitong.Indicators.databean.IndicatorBreakdownDatabean;
import net.huashitong.Indicators.entity.CompletionClassification;
import net.huashitong.Indicators.entity.IndicatorBreakdown;
import net.huashitong.Indicators.entity.TertiaryIndustry;
import net.huashitong.Indicators.filter.IndicatorBreakdownFilter;
import net.huashitong.Indicators.utils.CodeUtils;
import net.huashitong.Indicators.utils.Comparators;
import net.huashitong.Indicators.utils.ComparatorsUtils;
import net.huashitong.Indicators.utils.DataUtils;
import net.huashitong.Indicators.utils.DateForIndUtils;
import net.huashitong.Indicators.utils.IndustryNameUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sirdc.modules.utils.ObjectUtils;
import com.sirdc.modules.utils.StringUtils;

@Service
public class SolidInvestmentService {
    @Autowired
    private IndicatorBreakdownService breakdownService;
    @Autowired
    private CompletionClassificationService classificationService;
    @Autowired
    private TertiaryIndustryService industryService;
    @Autowired
    private TertiaryIndustryService tertiaryIndustryService;

    /**
     * 图一
     *
     * @param filter
     * @return
     */
    public Map<String, Object> queryCountyRankThi(
            IndicatorBreakdownFilter filter) {
        filter = IndustryNameUtils.changeName(filter);

        Map<String, Object> map = new HashMap<String, Object>();
        List<IndicatorBreakdown> lists = breakdownService.queryCountyRank(filter);
        List<IndicatorBreakdownDatabean> databeans = new ArrayList<IndicatorBreakdownDatabean>();
        DecimalFormat df = new DecimalFormat("#.#");
        for (IndicatorBreakdown indicatorBreakdown : lists) {
            List<IndicatorBreakdownDatabean> breakdownDatabeans = new ArrayList<IndicatorBreakdownDatabean>();
            IndicatorBreakdownDatabean databean = new IndicatorBreakdownDatabean();
            if (IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
                String st = //df.format(Double.parseDouble(indicatorBreakdown.getCumulative()));
                        StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000, 2);
                databean.setRightValue(st);
            } else {
                String st =//df.format(Double.parseDouble(indicatorBreakdown.getCumulative())/10000);
                        StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000, 2);
                databean.setRightValue(st);
            }
            breakdownDatabeans.add(databean);
            databean = new IndicatorBreakdownDatabean();
            databean.setRightValue(StringUtils.isBlank(indicatorBreakdown.getRatio().trim()) ? "0" : NumberUtils.keepPrecision(indicatorBreakdown.getRatio().trim(), 2) /*df.format(Double.parseDouble(indicatorBreakdown.getRatio()))*/);
            breakdownDatabeans.add(databean);
            databean = new IndicatorBreakdownDatabean();
            databean.setLeftValue(indicatorBreakdown.getArea());
            databean.setRightdata(breakdownDatabeans);
            databeans.add(databean);
        }
        String oneTitle = "";
        if (CodeUtils.monthOrQuarter_mon.equals(filter.getMonthOrQuarter())) {
            if (IndustryNameUtils.OutTotalIndexId.equals(filter.getIndustryId()) || IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
                oneTitle = "累计至当月完成(万美元)";
            } else if (IndustryNameUtils.CityIncomeIndexId.equals(filter.getIndustryId()) || IndustryNameUtils.CountryIncomeIndexId.equals(filter.getIndustryId())) {
                oneTitle = "累计至当月完成(元)";
            } else {
                oneTitle = "累计至当月完成(亿元)";
            }

        } else {
            if (IndustryNameUtils.OutTotalIndexId.equals(filter.getIndustryId()) || IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
                oneTitle = filter.getCurrentMonth().substring(2, 4) + "年1-" + filter.getCurrentMonth().substring(filter.getCurrentMonth().length() - 1) + "月季度完成值(万美元)";
            } else if (IndustryNameUtils.CityIncomeIndexId.equals(filter.getIndustryId()) || IndustryNameUtils.CountryIncomeIndexId.equals(filter.getIndustryId())) {
                oneTitle = filter.getCurrentMonth().substring(2, 4) + "年1-" + filter.getCurrentMonth().substring(filter.getCurrentMonth().length() - 1) + "月季度完成值(万元)";
            } else {
                oneTitle = filter.getCurrentMonth().substring(2, 4) + "年1-" + filter.getCurrentMonth().substring(filter.getCurrentMonth().length() - 1) + "月季度完成值(亿元)";
            }

        }
        map.put("data", databeans);
        map.put("title", filter.getIndustryName() + "各县市排名");
        map.put("firTitle", "县市");
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        String twoTitle = "同比增长率(%)";
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
        return map;
    }

    /**
     * 图三
     *
     * @param filter
     * @return
     * @throws ParseException
     */
    public Map<String, Object> queryMonthAbsoluteThi(
            IndicatorBreakdownFilter filter) throws ParseException {
        List<IndicatorBreakdownDatabean> breakdownDatabeans = new ArrayList<IndicatorBreakdownDatabean>();
        String oneTitle = "";
        String twoTitle = "";
        String title = "";
        filter = IndustryNameUtils.changeName(filter);
        TertiaryIndustry industry = tertiaryIndustryService.getById(filter.getIndustryId());
        if (CodeUtils.monthOrQuarter_mon.equals(filter.getMonthOrQuarter())) {
            oneTitle = "当月绝对值(" + industry.getUnit() + ")";
            twoTitle = "当月同比增长率(%)";
            title = industry.getIndicatorName() + "各月绝对值及同比增长情况";
            breakdownDatabeans = getMonthValue(filter);
        } else {
            oneTitle = "当季绝对值(" + industry.getUnit() + ")";
            twoTitle = "当季同比增长率(%)";
            title = industry.getIndicatorName() + "各季度绝对值及同比增长情况";
            breakdownDatabeans = getQuarterValue(filter);
        }
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map.put("title", title);
        map.put("firTitle", "时间");
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
        map.put("data", breakdownDatabeans);
        return map;
    }

    /**
     * 获取第三张图季度数据
     *
     * @param filter
     * @return
     * @throws NumberFormatException
     * @throws ParseException
     */
    private List<IndicatorBreakdownDatabean> getQuarterValue(
            IndicatorBreakdownFilter filter) throws NumberFormatException, ParseException {
        filter = IndustryNameUtils.changeName(filter);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate().substring(0, 4), 0));
        List<IndicatorBreakdown> breakdowns = breakdownService.queryAbsoluteValue(filter);
        List<IndicatorBreakdownDatabean> breakdownDatabeans = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabeans = DataUtils.detailData(breakdowns, breakdownDatabeans);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        List<IndicatorBreakdown> breakdownSs = breakdownService.queryAbsoluteValue(filter);
        breakdownDatabeans = DataUtils.detailData(breakdownSs, breakdownDatabeans);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        breakdownSs = breakdownService.queryAbsoluteValue(filter);
        breakdownDatabeans = DataUtils.detailData(breakdownSs, breakdownDatabeans);
        List<IndicatorBreakdownDatabean> breakdownDatabeans3 = new ArrayList<IndicatorBreakdownDatabean>();
        for (IndicatorBreakdownDatabean breakdownDatabean : breakdownDatabeans) {
            List<IndicatorBreakdownDatabean> databeans = new ArrayList<IndicatorBreakdownDatabean>();
            IndicatorBreakdownDatabean breakdownDatabean2 = new IndicatorBreakdownDatabean();
            if (breakdownDatabean.getCurrentMonth().substring(0, 4).contains(filter.getDate())) {
                continue;
            }
            DecimalFormat df = new DecimalFormat("#.##");
            String st = "";
            Double double5 = Double.parseDouble(breakdownDatabean.getSeasonsComparison());
            if (breakdownDatabean.getCurrentMonth().contains("02")) {
                double5 = double5 / 2;
                st = df.format(double5 / 10000);
                breakdownDatabean2.setRightValue(st);
            } else {
                st = df.format(double5 / 10000);
                breakdownDatabean2.setRightValue(st);
            }
            databeans.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            breakdownDatabean2.setRightValue("0");
            for (IndicatorBreakdownDatabean databean2 : breakdownDatabeans) {
                if (databean2.getCurrentMonth().contains(DateForIndUtils.getNextMonthDate(breakdownDatabean.getCurrentMonth(), -12))) {
                    Double double6 = Double.parseDouble(databean2.getSeasonsComparison());
                    Double double7 = (double5 - double6) / double6 * 100;
                    if (double7 != 0) {
                        st = df.format(double7);
                        breakdownDatabean2.setRightValue(st);
                    }
                }
            }
            databeans.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            breakdownDatabean2.setLeftValue(breakdownDatabean.getCurrentMonth().substring(0, 4) + "." + breakdownDatabean.getCurrentMonth().substring(4));
            breakdownDatabean2.setRightdata(databeans);
            breakdownDatabeans3.add(breakdownDatabean2);
        }
        return breakdownDatabeans3;
    }

    /**
     * 获取第三张图月份数据
     *
     * @param filter
     * @return
     * @throws ParseException
     */
    private List<IndicatorBreakdownDatabean> getMonthValue(
            IndicatorBreakdownFilter filter) throws ParseException {
        filter = IndustryNameUtils.changeName(filter);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate().substring(0, 4), 0));
        List<IndicatorBreakdown> breakdowns = breakdownService.queryMonthAbsolute(filter);
        List<IndicatorBreakdownDatabean> breakdownDatabeans = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabeans = DataUtils.detailData(breakdowns, breakdownDatabeans);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        List<IndicatorBreakdown> breakdownSs = breakdownService.queryMonthAbsolute(filter);
        breakdownDatabeans = DataUtils.detailData(breakdownSs, breakdownDatabeans);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        breakdownSs = breakdownService.queryMonthAbsolute(filter);
        breakdownDatabeans = DataUtils.detailData(breakdownSs, breakdownDatabeans);
        List<IndicatorBreakdownDatabean> breakdownDatabeans3 = new ArrayList<IndicatorBreakdownDatabean>();
        for (IndicatorBreakdownDatabean breakdownDatabean : breakdownDatabeans) {
            List<IndicatorBreakdownDatabean> databeans = new ArrayList<IndicatorBreakdownDatabean>();
            IndicatorBreakdownDatabean breakdownDatabean2 = new IndicatorBreakdownDatabean();
            if (breakdownDatabean.getCurrentMonth().substring(0, 4).contains(filter.getDate())) {
                continue;
            }
            DecimalFormat df = new DecimalFormat("#.##");
            String st = "";
            Double double5 = Double.parseDouble(breakdownDatabean.getSeasonsComparison());
            if (breakdownDatabean.getCurrentMonth().contains("02")) {
                double5 = double5 / 2;
            }
            if (IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
                st = df.format(double5 / 100);
                breakdownDatabean2.setRightValue(st);
            } else {
                st = df.format(double5 / 10000);
                breakdownDatabean2.setRightValue(st);
            }
            databeans.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            breakdownDatabean2.setRightValue("0");
            for (IndicatorBreakdownDatabean databean2 : breakdownDatabeans) {
                if (databean2.getCurrentMonth().contains(DateForIndUtils.getNextMonthDate(breakdownDatabean.getCurrentMonth(), -12))) {
                    breakdownDatabean2 = new IndicatorBreakdownDatabean();
                    Double double6 = Double.parseDouble(databean2.getSeasonsComparison());
                    Double double7 = (double5 - double6) / double6 * 100;
                    if (double7 != 0) {
                        st = df.format(double7);
                        breakdownDatabean2.setRightValue(st);
                    }
                }
            }
            databeans.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            breakdownDatabean2.setLeftValue(breakdownDatabean.getCurrentMonth().substring(0, 4) + "." + breakdownDatabean.getCurrentMonth().substring(4));
            breakdownDatabean2.setRightdata(databeans);
            breakdownDatabeans3.add(breakdownDatabean2);
        }
        return breakdownDatabeans3;
    }

    /**
     * 第四张图
     *
     * @param filter
     * @return
     * @throws ParseException
     */
    public Map<String, Object> queryMonthCountAbsoluteThi(
            IndicatorBreakdownFilter filter) throws ParseException {
        String oneTitle = "";
        String twoTitle = "";
        String title = "";
        //TertiaryIndustry industry = tertiaryIndustryService.getById(filter.getIndustryId());
        filter = IndustryNameUtils.changeName(filter);
        List<IndicatorBreakdownDatabean> breakdownDatabeans4 = new ArrayList<IndicatorBreakdownDatabean>();
        if (CodeUtils.monthOrQuarter_mon.equals(filter.getMonthOrQuarter())) {
            if ("A15".equals(filter.getIndustryId())) {
                oneTitle = "当月累计完成(万美元)";
            } else if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                oneTitle = "当月累计完成(元)";
            } else {
                oneTitle = "当月累计完成(亿元)";
            }

            twoTitle = "同比增长率(%)";
            title = filter.getIndustryName() + "各月累计绝对值及同比增长情况";
            breakdownDatabeans4 = getMonthCountValue(filter);
        } else {
            if ("A15".equals(filter.getIndustryId())) {
                oneTitle = "当季累计完成(万美元)";
            } else if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                oneTitle = "当月累计完成(元)";
            } else {
                oneTitle = "当季累计完成(亿元)";
            }

            twoTitle = "同比增长率(%)";
            title = filter.getIndustryName() + "各季度累计绝对值及同比增长情况";
            breakdownDatabeans4 = getQuarterCountValue(filter);
        }
        Map<String, Object> map32 = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map32.put("title", title);
        map32.put("firTitle", "时间");
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map32.put("secTitle", secTitle);
//		map32.put("left", breakdownDatabean4s);
        map32.put("data", breakdownDatabeans4);
        return map32;
    }

    /**
     * 第四张图季度数据
     *
     * @param filter
     * @return
     * @throws ParseException
     */
    private List<IndicatorBreakdownDatabean> getQuarterCountValue(
            IndicatorBreakdownFilter filter) throws ParseException {
        filter = IndustryNameUtils.changeName(filter);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate().substring(0, 4), 0));
        List<IndicatorBreakdown> breakdown3s = breakdownService.queryAbsoluteValue(filter);
        List<IndicatorBreakdownDatabean> breakdownDatabean3s = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabean3s = DataUtils.detailcumulativeData(breakdown3s, breakdownDatabean3s);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        List<IndicatorBreakdown> breakdown3Ss = breakdownService.queryAbsoluteValue(filter);
        breakdownDatabean3s = DataUtils.detailcumulativeData(breakdown3Ss, breakdownDatabean3s);
        List<IndicatorBreakdownDatabean> breakdownDatabeans4 = new ArrayList<IndicatorBreakdownDatabean>();
        for (IndicatorBreakdownDatabean indicatorBreakdown : breakdownDatabean3s) {
            List<IndicatorBreakdownDatabean> breakdownDatabean4s = new ArrayList<IndicatorBreakdownDatabean>();
            IndicatorBreakdownDatabean breakdownDatabean2 = new IndicatorBreakdownDatabean();
            DecimalFormat df = new DecimalFormat("#.##");
            String st = "-";
            if (ObjectUtils.isNotBlank(indicatorBreakdown.getCumulative())) {
                if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                    st = df.format(Double.parseDouble(indicatorBreakdown.getCumulative()));
                } else {
                    st = df.format(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000);
                }

            }

            breakdownDatabean2.setRightValue(st);
            breakdownDatabean4s.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            if (ObjectUtils.isNotBlank(indicatorBreakdown.getRatio())) {
                st = df.format(Double.parseDouble(indicatorBreakdown.getRatio()));
                if ("0".equals(st)) {
                    st = "-";
                }
            }
            breakdownDatabean2.setRightValue(st);
            breakdownDatabean4s.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            breakdownDatabean2.setLeftValue(indicatorBreakdown.getCurrentMonth().substring(0, 4) + "." + indicatorBreakdown.getCurrentMonth().substring(4));
            breakdownDatabean2.setRightdata(breakdownDatabean4s);
            breakdownDatabeans4.add(breakdownDatabean2);
//			IndicatorBreakdownDatabean breakdownDatabean = new IndicatorBreakdownDatabean();
//			breakdownDatabean4s.add(breakdownDatabean);
        }
        return breakdownDatabeans4;
    }

    /**
     * 第四张图月份数据
     *
     * @param filter
     * @return
     */
    private List<IndicatorBreakdownDatabean> getMonthCountValue(
            IndicatorBreakdownFilter filter) throws ParseException {
        filter = IndustryNameUtils.changeName(filter);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate().substring(0, 4), 0));
        List<IndicatorBreakdown> breakdown3s = breakdownService.queryMonthAbsolute(filter);
        List<IndicatorBreakdownDatabean> breakdownDatabean3s = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabean3s = DataUtils.detailcumulativeData(breakdown3s, breakdownDatabean3s);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        List<IndicatorBreakdown> breakdown3Ss = breakdownService.queryMonthAbsolute(filter);
        breakdownDatabean3s = DataUtils.detailcumulativeData(breakdown3Ss, breakdownDatabean3s);
        List<IndicatorBreakdownDatabean> breakdownDatabeans4 = new ArrayList<IndicatorBreakdownDatabean>();
        for (IndicatorBreakdownDatabean indicatorBreakdown : breakdownDatabean3s) {
            List<IndicatorBreakdownDatabean> breakdownDatabean4s = new ArrayList<IndicatorBreakdownDatabean>();
            IndicatorBreakdownDatabean breakdownDatabean2 = new IndicatorBreakdownDatabean();
            DecimalFormat df = new DecimalFormat("#.##");
            if (IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
                String st = df.format(Double.parseDouble(indicatorBreakdown.getCumulative()) / 100);

                breakdownDatabean2.setRightValue(st);
            } else {
                String st = "-";
                if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                    st =//df.format(Double.parseDouble(indicatorBreakdown.getCumulative()));
                            StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getCumulative()), 2);
                } else {
                    st =//df.format(Double.parseDouble(indicatorBreakdown.getCumulative())/10000);
                            StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000, 2);
                }

                breakdownDatabean2.setRightValue(st);
            }
            breakdownDatabean4s.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            String st = //df.format(Double.parseDouble(indicatorBreakdown.getRatio()));
                    StringUtils.isBlank(indicatorBreakdown.getRatio()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getRatio()), 2);
            breakdownDatabean2.setRightValue(st);
            breakdownDatabean4s.add(breakdownDatabean2);
            breakdownDatabean2 = new IndicatorBreakdownDatabean();
            breakdownDatabean2.setLeftValue(indicatorBreakdown.getCurrentMonth().substring(0, 4) + "." + indicatorBreakdown.getCurrentMonth().substring(4));
            breakdownDatabean2.setRightdata(breakdownDatabean4s);
            breakdownDatabeans4.add(breakdownDatabean2);
//			IndicatorBreakdownDatabean breakdownDatabean = new IndicatorBreakdownDatabean();
//			breakdownDatabean4s.add(breakdownDatabean);
        }
        return breakdownDatabeans4;
    }

    public Map<String, Object> queryByXZValueThi(IndicatorBreakdownFilter filter) {
        filter = IndustryNameUtils.changeName(filter);
        filter.setXz("乡镇");
        List<CompletionClassification> classification2s = classificationService.queryByXZValue(filter);
        List<CompletionClassificationDatabean> classificationDatabean2s = new ArrayList<CompletionClassificationDatabean>();
        List<CompletionClassificationDatabean> classificationDatabeans = new ArrayList<CompletionClassificationDatabean>();
        Double double1 = new Double(0);
        Double double2 = new Double(0);
        Double double3 = new Double(0);
        for (CompletionClassification completionClassification : classification2s) {
            classificationDatabeans = new ArrayList<CompletionClassificationDatabean>();
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
//			CompletionClassificationDatabean classification2 = new CompletionClassificationDatabean();
            classification.setRightValue(completionClassification.getPlanneValue());
            classificationDatabeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setRightValue(completionClassification.getActualCompletionValue());
            classificationDatabeans.add(classification);
            Double doublebs1 = Double.parseDouble(completionClassification.getActualCompletionValue());
            double1 += doublebs1;
            Double doublebs2 = Double.parseDouble(completionClassification.getPlanneValue());
            double2 += doublebs2;
            Double doublebs3 = doublebs1 / doublebs2 * 100;
            DecimalFormat df = new DecimalFormat("#.##");
            String st = df.format(doublebs3);
            classification = new CompletionClassificationDatabean();
            if ("0".equals(completionClassification.getActualCompletionValue())) {
                classification.setRightValue("0");
            } else {
                classification.setRightValue(st);
            }
            classificationDatabeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setLeftValue(completionClassification.getCategoryDetails());
            classification.setRightdata(classificationDatabeans);
            classificationDatabean2s.add(classification);
//			classificationDatabeans.add(classification2);
        }
        double3 = double1 / double2 * 100;
        DecimalFormat df = new DecimalFormat("#.##");
        String st = df.format(double3);
        classificationDatabeans = new ArrayList<CompletionClassificationDatabean>();
        CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
        classification.setRightValue(Double.toString(double2));
        classificationDatabeans.add(classification);
        classification = new CompletionClassificationDatabean();
        classification.setRightValue(Double.toString(double1));
        classificationDatabeans.add(classification);
        classification = new CompletionClassificationDatabean();
        classification.setRightValue(st);
        classificationDatabeans.add(classification);
        classification = new CompletionClassificationDatabean();
        classification.setLeftValue("合计");
        classification.setRightdata(classificationDatabeans);
        classificationDatabean2s.add(classification);
//		classification = new CompletionClassificationDatabean();
//		classificationDatabeans.add(classification);
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map.put("title", filter.getIndustryName() + "按乡镇分类完成情况");
        map.put("firTitle", "乡镇");
        String oneTitle = "年计划数(万元)";
        String twoTitle = "完成数(万元)";
        String thiTitle = "完成比率(%)";
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", thiTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
//		map.put("left", classificationDatabeans);
        map.put("data", classificationDatabean2s);
        return map;
    }

    public Map<String, Object> queryMonthDevelopmentSituationThi(
            IndicatorBreakdownFilter filter) throws ParseException {
        List<IndicatorBreakdownDatabean> breakdownDatabean2s = new ArrayList<IndicatorBreakdownDatabean>();
        String oneTitle = "";
        String twoTitle = "";
        String thiTitle = "";
        String fourTitle = "";
        String title = "";
        filter = IndustryNameUtils.changeName(filter);
        TertiaryIndustry industry = tertiaryIndustryService.getById(filter.getIndustryId());
        if (CodeUtils.monthOrQuarter_mon.equals(filter.getMonthOrQuarter())) {
            if ("A15".equals(filter.getIndustryId())) {
                oneTitle = "当月绝对值(万美元)";
                twoTitle = "当月累计绝对值(万美元)";
            } else if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                oneTitle = "当月绝对值(元)";
                twoTitle = "当月累计绝对值(元)";
            } else {
                oneTitle = "当月绝对值(亿元)";
                twoTitle = "当月累计绝对值(亿元)";
            }

            thiTitle = "当月同比增长率(%)";
            fourTitle = "当月累计增长率(%)";
            title = filter.getIndustryName() + "当月同比增长情况";
            breakdownDatabean2s = queryMonthDevelopmentSituation(filter);
        } else {
            if ("A15".equals(filter.getIndustryId())) {
                oneTitle = "当季绝对值(万美元)";
                twoTitle = "当季累计绝对值(万美元)";
            } else if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                oneTitle = "当季绝对值(元)";
                twoTitle = "当季累计绝对值(元)";
            } else {
                oneTitle = "当季绝对值(亿元)";
                twoTitle = "当季累计绝对值(亿元)";
            }

            thiTitle = "当季同比增长率(%)";
            fourTitle = "当季累计增长率(%)";
            title = filter.getIndustryName() + "当季同比增长情况";
            breakdownDatabean2s = queryDevelopmentSituation(filter);
        }

//		List<IndicatorBreakdownDatabean> breakdownDatabeans = new ArrayList<IndicatorBreakdownDatabean>();
//		IndicatorBreakdownDatabean databean3 = new IndicatorBreakdownDatabean();
//		
//		breakdownDatabeans.add(databean3);
//		databean3 = new IndicatorBreakdownDatabean();
//		
//		breakdownDatabeans.add(databean3);
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map.put("title", title);
        map.put("firTitle", "时间");
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", thiTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", fourTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
//		map.put("left", breakdownDatabeans);
        map.put("data", breakdownDatabean2s);
        return map;
    }

    private List<IndicatorBreakdownDatabean> queryDevelopmentSituation(
            IndicatorBreakdownFilter filter) throws ParseException {
        filter = IndustryNameUtils.changeName(filter);
        String date = filter.getCurrentMonth().substring(0, 4);
        List<IndicatorBreakdownDatabean> breakdownDatabean2s = new ArrayList<IndicatorBreakdownDatabean>();
        List<IndicatorBreakdown> lists2 = breakdownService.queryDevelopmentSituation(filter);
        IndicatorBreakdownDatabean databean = new IndicatorBreakdownDatabean();
        String lastDateVal = "";
        String DateVal = "";
        for (IndicatorBreakdown indicatorBreakdown : lists2) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -3))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
                databean.setRightFou(indicatorBreakdown.getRatio());
                DecimalFormat df = new DecimalFormat("#.##");
                String st = "-";
                if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                    df.format(Double.parseDouble(indicatorBreakdown.getCumulative()));
                } else {
                    df.format(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000);
                }
                databean.setRightSec(st);
            }

        }
        Double double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        Double double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        Double double3 = double2 - double1;
        DecimalFormat df = new DecimalFormat("#.##");
        String st = "0";
        if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
            st = df.format(double3);
        } else {
            st = df.format(double3 / 10000);
        }

        databean.setRightOne(st);
        //查找去年当季和去年当月前一个月数据
        filter.setCurrentMonth(DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -12));
        IndicatorBreakdownDatabean databean2 = new IndicatorBreakdownDatabean();
        List<IndicatorBreakdown> indicatorBreakdowns = breakdownService.queryDevelopmentSituation(filter);
        for (IndicatorBreakdown indicatorBreakdown : indicatorBreakdowns) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -3))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
                databean2.setRightFou(indicatorBreakdown.getRatio());
            }
        }
        double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
            st = df.format(double2);
            databean2.setRightSec(st);
            st = df.format(double2 - double1);
            databean2.setRightOne(st);
        } else {
            st = df.format(double2 / 10000);
            databean2.setRightSec(st);
            st = df.format((double2 - double1) / 10000);
            databean2.setRightOne(st);
        }

        Double double4 = double2 - double1;
        double3 = (double3 - double4) / double4 * 100;
        if (double3 != 0) {
            st = df.format(double3);
            databean.setRightThi(st);
        }
        databean.setLeftValue(date);
        databean2.setLeftValue(filter.getCurrentMonth().substring(0, 4));
        double3 = double2 - double1;
        filter.setCurrentMonth(DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -12));
        List<IndicatorBreakdown> indicatorBreakdown2s = breakdownService.queryDevelopmentSituation(filter);
        for (IndicatorBreakdown indicatorBreakdown : indicatorBreakdown2s) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -3))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
            }
        }
        double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        double4 = double2 - double1;
        double3 = (double3 - double4) / double4 * 100;
        if (double3 != 0) {
            df = new DecimalFormat("#.##");
            st = df.format(double3);
            databean2.setRightThi(st);
        }
        List<IndicatorBreakdownDatabean> databeans = new ArrayList<IndicatorBreakdownDatabean>();
        IndicatorBreakdownDatabean breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightOne());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightSec());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightThi());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightFou());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setLeftValue(databean.getLeftValue());
        breakdownDatabean.setRightdata(databeans);
        breakdownDatabean2s.add(breakdownDatabean);

        databeans = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean2.getRightOne());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean2.getRightSec());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        if (StringUtils.isBlank(databean2.getRightThi())) {
            breakdownDatabean.setRightValue("0");
        } else {
            breakdownDatabean.setRightValue(databean2.getRightThi());
        }
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean2.getRightFou());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setLeftValue(databean2.getLeftValue());
        breakdownDatabean.setRightdata(databeans);
        breakdownDatabean2s.add(breakdownDatabean);
        return breakdownDatabean2s;
    }

    /**
     * 第二张图月份数据
     *
     * @param filter
     * @return
     * @throws ParseException
     */
    private List<IndicatorBreakdownDatabean> queryMonthDevelopmentSituation(
            IndicatorBreakdownFilter filter) throws ParseException {
        filter = IndustryNameUtils.changeName(filter);
        String date = filter.getCurrentMonth().substring(0, 4);
        List<IndicatorBreakdownDatabean> breakdownDatabean2s = new ArrayList<IndicatorBreakdownDatabean>();
        List<IndicatorBreakdown> lists2 = breakdownService.queryMonthDevelopmentSituation(filter);
        IndicatorBreakdownDatabean databean = new IndicatorBreakdownDatabean();
        String lastDateVal = "";
        String DateVal = "";
        DecimalFormat df = new DecimalFormat("#.##");
        for (IndicatorBreakdown indicatorBreakdown : lists2) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -1))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
                databean.setRightFou(df.format(Double.parseDouble(indicatorBreakdown.getRatio())));
                String st = "-";
                if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                    st = df.format(Double.parseDouble(indicatorBreakdown.getCumulative()));
                } else {
                    st =//df.format(Double.parseDouble(indicatorBreakdown.getCumulative())/10000);
                            StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000, 2);

                }

                databean.setRightSec(st);
            }

        }
        Double double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        Double double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        Double double3 = double2 - double1;
        String st = "";
        if (IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
            st = df.format(double3 / 100);
            databean.setRightOne(st);
        } else {
            if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                st = df.format(double3);
            } else {
                st = df.format(double3 / 10000);
            }

            databean.setRightOne(st);
        }

        //查找去年当季和去年当月前一个月数据
        filter.setCurrentMonth(DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -12));
        IndicatorBreakdownDatabean databean2 = new IndicatorBreakdownDatabean();
        List<IndicatorBreakdown> indicatorBreakdowns = breakdownService.queryMonthDevelopmentSituation(filter);
        for (IndicatorBreakdown indicatorBreakdown : indicatorBreakdowns) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -1))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();

                databean2.setRightFou(df.format(Double.parseDouble(indicatorBreakdown.getRatio())));
            }
        }
        double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        if (IndustryNameUtils.RealOutForeignIndexId.equals(filter.getIndustryId())) {
            st = df.format(double2 / 100);
            databean2.setRightSec(st);
            st = df.format((double2 - double1) / 100);
            databean2.setRightOne(st);
        } else {
            st = df.format(double2 / 10000);
            databean2.setRightSec(st);
            if ("A18".equals(filter.getIndustryId()) || "A19".equals(filter.getIndustryId())) {
                st = df.format((double2 - double1));
            } else {
                st = df.format((double2 - double1) / 10000);
            }

            databean2.setRightOne(st);
        }
        Double double4 = double2 - double1;
        double3 = (double3 - double4) / double4 * 100;
        if (double3 != 0) {
            st = df.format(double3);
            databean.setRightThi(st);
        }
        databean.setLeftValue(date);
        databean2.setLeftValue(filter.getCurrentMonth().substring(0, 4));
        double3 = double2 - double1;
        filter.setCurrentMonth(DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -12));
        List<IndicatorBreakdown> indicatorBreakdown2s = breakdownService.queryMonthDevelopmentSituation(filter);
        for (IndicatorBreakdown indicatorBreakdown : indicatorBreakdown2s) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -1))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
            }
        }
        if (ObjectUtils.isNotBlank(indicatorBreakdown2s)) {
            double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
            double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
            double4 = double2 - double1;
            double3 = (double3 - double4) / double4 * 100;
            if (double3 != 0) {
                df = new DecimalFormat("#.##");
                st = df.format(double3);
                databean2.setRightThi(st);
            }
        }
        List<IndicatorBreakdownDatabean> databeans = new ArrayList<IndicatorBreakdownDatabean>();
        IndicatorBreakdownDatabean breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightOne());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightSec());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightThi());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean.getRightFou());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setLeftValue(databean.getLeftValue());
        breakdownDatabean.setRightdata(databeans);
        breakdownDatabean2s.add(breakdownDatabean);

        databeans = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean2.getRightOne());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean2.getRightSec());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        if (StringUtils.isBlank(databean2.getRightThi())) {
            breakdownDatabean.setRightValue("0");
        } else {
            breakdownDatabean.setRightValue(databean2.getRightThi());
        }
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setRightValue(databean2.getRightFou());
        databeans.add(breakdownDatabean);
        breakdownDatabean = new IndicatorBreakdownDatabean();
        breakdownDatabean.setLeftValue(databean2.getLeftValue());
        breakdownDatabean.setRightdata(databeans);
        breakdownDatabean2s.add(breakdownDatabean);
        return breakdownDatabean2s;
    }

    public Map<String, Object> queryByBMValueThi(IndicatorBreakdownFilter filter) {
        filter = IndustryNameUtils.changeName(filter);
        filter.setBm("部门");
        List<CompletionClassification> classifications = classificationService.queryByValue(filter);
        List<CompletionClassificationDatabean> classificationDatabeans = new ArrayList<CompletionClassificationDatabean>();
//		List<CompletionClassificationDatabean> classificationDatabeans2 = new ArrayList<CompletionClassificationDatabean>(); 
        for (CompletionClassification completionClassification : classifications) {
            List<CompletionClassificationDatabean> databeans = new ArrayList<CompletionClassificationDatabean>();
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
//			CompletionClassificationDatabean classification2 = new CompletionClassificationDatabean();
            classification.setRightValue(completionClassification.getPlanneValue());
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setRightValue(completionClassification.getActualCompletionValue());
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            Double double1 = Double.parseDouble(completionClassification.getActualCompletionValue());
            Double double2 = Double.parseDouble(completionClassification.getPlanneValue());
            Double double3 = double1 / double2 * 100;
            if (double3 > 1) {
                DecimalFormat df = new DecimalFormat("#.##");
                String st = df.format(double1 / double2 * 100);
                classification.setRightValue(st);
            } else {
                classification.setRightValue("0");
            }
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setLeftValue(completionClassification.getCategoryDetails());
            classification.setRightdata(databeans);
            classificationDatabeans.add(classification);
//			classificationDatabeans2.add(classification2);
        }
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map.put("title", filter.getIndustryName() + "按部门分类完成情况");
        map.put("firTitle", "部门");
        String oneTitle = "年计划数(万元)";
        String twoTitle = "完成数(万元)";
        String thiTitle = "完成比率(%)";
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", thiTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
//		map.put("left", classificationDatabeans2);
        map.put("data", classificationDatabeans);
        return map;
    }

    public Map<String, Object> queryByDWValueThi(IndicatorBreakdownFilter filter) {
        filter = IndustryNameUtils.changeName(filter);
        filter.setQy("企业");
        List<CompletionClassification> classificationds = classificationService.queryByDWValue(filter);
        List<CompletionClassificationDatabean> classificationDatabeands = new ArrayList<CompletionClassificationDatabean>();
        for (CompletionClassification completionClassification : classificationds) {
            List<CompletionClassificationDatabean> databeans = new ArrayList<CompletionClassificationDatabean>();
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            classification.setRightValue(completionClassification.getPlanneValue());
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setRightValue(completionClassification.getActualCompletionValue());
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            Double doubleds1 = Double.parseDouble(completionClassification.getActualCompletionValue());
            Double doubleds2 = Double.parseDouble(completionClassification.getPlanneValue());
            Double doubleds3 = doubleds1 / doubleds2 * 100;
            DecimalFormat df = new DecimalFormat("#.##");
            if (doubleds3 == 0) {
                classification.setRightValue(Double.toString(doubleds3));
            } else {
                String st = df.format(doubleds3);
                classification.setRightValue(st);
            }
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setRightValue("待填充");
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setRightValue("待填充");
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setRightValue("待填充");
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setLeftValue(completionClassification.getCategoryDetails());
            classification.setRightdata(databeans);
            classificationDatabeands.add(classification);
//			classificationDatabeands2.add(classification2);
        }
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map.put("title", filter.getIndustryName() + "按企业分类完成情况");
        map.put("firTitle", "企业");
        String oneTitle = "计划投资(万元)";
        String twoTitle = "完成数(万元)";
        String thiTitle = "完成比率(%)";
        String fouTitle = "分管领导";
        String fivTitle = "责任单位";
        String sixTitle = "服务内容";
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", thiTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", fouTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", fivTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", sixTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
//		map.put("left", classificationDatabeands2);
        map.put("data", classificationDatabeands);
        return map;
    }

    public IndicatorBreakdownDatabean queryCountyRank(
            IndicatorBreakdownFilter filter) {
        List<IndicatorBreakdownDatabean> databeans = new ArrayList<IndicatorBreakdownDatabean>();
        List<IndicatorBreakdown> lists = breakdownService.queryCountyRank(filter);
        System.out.println("gu1=" + lists.size());
        if (lists.size() < 3) {
            return null;
        }
        IndicatorBreakdownDatabean databeans2 = new IndicatorBreakdownDatabean();
        DecimalFormat df = new DecimalFormat("#.##");
        for (IndicatorBreakdown indicatorBreakdown : lists) {
            IndicatorBreakdownDatabean databean = new IndicatorBreakdownDatabean();
            databean.setArea(indicatorBreakdown.getArea());
            databean.setRatio(StringUtils.isBlank(indicatorBreakdown.getRatio()) ? "0" : Double.parseDouble(indicatorBreakdown.getRatio())+""); // df.format()     );
//            databean.setRatio(StringUtils.isBlank(indicatorBreakdown.getRatio()) ? "0" : NumberUtils.keepPrecision(df.format(Double.parseDouble(indicatorBreakdown.getRatio()) / 10000), 2)); // df.format(Double.parseDouble(indicatorBreakdown.getRatio()))     );
            databean.setCumulative(StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(df.format(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000), 2)  /*df.format(Double.parseDouble(indicatorBreakdown.getCumulative())/10000)*/);
			/*if(indicatorBreakdown.getArea().contains("福州市")){
				databeans.add(0, databean);
			}else if(indicatorBreakdown.getArea().contains("蕉城")){
				String st=df.format(Double.parseDouble(indicatorBreakdown.getExpectedTarget())/10000);
				databeans2.setExpectedTarget(st);
				databeans2.setArea(indicatorBreakdown.getArea());
				databeans.add(2, databean);
			}else {
				databeans.add(databean);
			}*/
            databeans.add(databean);
        }
        databeans2.setRightdata(databeans);
        return databeans2;
    }

    public List<IndicatorBreakdownDatabean> queryMonthDevelopment(
            IndicatorBreakdownFilter filter) throws ParseException {
        List<IndicatorBreakdownDatabean> breakdownDatabean2s = new ArrayList<IndicatorBreakdownDatabean>();
        List<IndicatorBreakdown> lists2 = breakdownService.queryMonthDevelopmentSituation(filter);
        //校验
        if (lists2.size() < 2) {
            return null;
        }
        //TertiaryIndustry industries = industryService.queryByfilter(filter);
		/*if(ObjectUtils.isBlank(industries)){
			return null;
		}*/
        IndicatorBreakdownDatabean databean = new IndicatorBreakdownDatabean();
        String lastDateVal = "";
        String DateVal = "";
        for (IndicatorBreakdown indicatorBreakdown : lists2) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -1))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
                databean.setRatio(indicatorBreakdown.getRatio());
            }

        }
        Double double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        Double double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        Double double3 = double2 - double1;
        //查找去年当季和去年当月前一个月数据
        filter.setCurrentMonth(DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -12));
        List<IndicatorBreakdown> indicatorBreakdowns = breakdownService.queryMonthDevelopmentSituation(filter);
        //校验
        if (indicatorBreakdowns.size() < 2) {
            return null;
        }
        for (IndicatorBreakdown indicatorBreakdown : indicatorBreakdowns) {
            if (StringUtils.equals(indicatorBreakdown.getCurrentMonth(), DateForIndUtils.getNextMonthDate(filter.getCurrentMonth(), -1))) {
                lastDateVal = indicatorBreakdown.getCumulative();
            } else {
                DateVal = indicatorBreakdown.getCumulative();
            }
        }
        double1 = Double.parseDouble(StringUtils.isBlank(lastDateVal) ? "0" : lastDateVal);
        double2 = Double.parseDouble(StringUtils.isBlank(DateVal) ? "0" : DateVal);
        Double double4 = double2 - double1;
        double3 = (double3 - double4) / double4 * 100;
        //databean.setCountyIncrease(industries.getCountyIncrease());
        //databean.setCityIncrease(industries.getCityIncrease());
        if (double3 != 0) {
            DecimalFormat df = new DecimalFormat("#.##");
            String st = df.format(double3);
            databean.setConcurrentGrowth(st);
        }
        //databean.setuBIncrease(industries.getuBIncrease());
        breakdownDatabean2s.add(databean);
        return breakdownDatabean2s;
    }

    public List<Map<String, Object>> queryMonthAbsolute(
            IndicatorBreakdownFilter filter) throws ParseException {
        IndicatorBreakdown breakdown = breakdownService.queryMonthValue(filter);
        if (ObjectUtils.isBlank(breakdown)) {
            return null;
        }
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate().substring(0, 4), 0));
        List<IndicatorBreakdown> breakdowns = breakdownService.queryMonthAbsolute(filter);
        List<IndicatorBreakdownDatabean> breakdownDatabeans = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabeans = DataUtils.detailData(breakdowns, breakdownDatabeans);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        List<IndicatorBreakdown> breakdownSs = breakdownService.queryMonthAbsolute(filter);
        DecimalFormat df = new DecimalFormat("#.##");
        breakdownDatabeans = DataUtils.detailData(breakdownSs, breakdownDatabeans);
        List<IndicatorBreakdownDatabean> breakdownDatabeans2 = new ArrayList<IndicatorBreakdownDatabean>();
        List<IndicatorBreakdownDatabean> breakdownDatabeans3 = new ArrayList<IndicatorBreakdownDatabean>();
        for (IndicatorBreakdownDatabean breakdownDatabean : breakdownDatabeans) {
            for (IndicatorBreakdownDatabean databean2 : breakdownDatabeans) {
                if (databean2.getCurrentMonth().contains(DateForIndUtils.getNextMonthDate(breakdownDatabean.getCurrentMonth(), -12))) {
                    Double double5 = Double.parseDouble(breakdownDatabean.getSeasonsComparison());
                    Double double6 = Double.parseDouble(databean2.getSeasonsComparison());
                    Double double7 = (double5 - double6) / double6 * 100;
                    if (double7 != 0) {
                        String st = df.format(double7);
                        breakdownDatabean.setConcurrentGrowth(st);
                    }
                }
            }
            String a = breakdownDatabean.getSeasonsComparison();
            if (StringUtils.isBlank(a)) {
                a = "0";
            }
            breakdownDatabean.setSeasonsComparison(df.format(Double.parseDouble(a) / 10000));
            if (breakdownDatabean.getCurrentMonth().contains("2016")) {
                breakdownDatabean.setCurrentMonth(breakdownDatabean.getCurrentMonth().substring(4));
                breakdownDatabeans2.add(breakdownDatabean);
            } else {
                breakdownDatabean.setCurrentMonth(breakdownDatabean.getCurrentMonth().substring(4));
                breakdownDatabeans3.add(breakdownDatabean);
            }
        }
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
        Map<String, Object> map2 = new HashMap<String, Object>();
        Collections.reverse(breakdownDatabeans2);
        Collections.reverse(breakdownDatabeans3);
        map2.put("lastYear", breakdownDatabeans2);
        map2.put("years", breakdownDatabeans3);
        list.add(map2);
        return list;
    }

    public List<Map<String, Object>> queryLJAbsolute(
            IndicatorBreakdownFilter filter) throws ParseException {
        IndicatorBreakdown breakdown = breakdownService.queryMonthValue(filter);
        if (ObjectUtils.isBlank(breakdown)) {
            return null;
        }
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate().substring(0, 4), 0));
//		filter.setDate(DateForIndUtils.getNextYearDate(date.substring(0,4),0));
        List<IndicatorBreakdown> breakdown3s = breakdownService.queryMonthAbsolute(filter);
        if (ObjectUtils.isBlank(breakdown3s)) {
            return null;
        }
        DecimalFormat df = new DecimalFormat("#.##");
        List<IndicatorBreakdownDatabean> breakdownDatabean3s = new ArrayList<IndicatorBreakdownDatabean>();
        breakdownDatabean3s = DataUtils.detailcumulativeData(breakdown3s, breakdownDatabean3s);
        filter.setDate(DateForIndUtils.getNextYearDate(filter.getDate(), -1));
        List<IndicatorBreakdown> breakdown3Ss = breakdownService.queryMonthAbsolute(filter);
        if (ObjectUtils.isBlank(breakdown3Ss)) {
            return null;
        }
        breakdownDatabean3s = DataUtils.detailcumulativeData(breakdown3Ss, breakdownDatabean3s);
        Map<String, Object> map = new HashMap<String, Object>();
        List<IndicatorBreakdownDatabean> breakdownDatabean4s = new ArrayList<IndicatorBreakdownDatabean>();
        List<IndicatorBreakdownDatabean> breakdownDatabeans4 = new ArrayList<IndicatorBreakdownDatabean>();
        for (IndicatorBreakdownDatabean indicatorBreakdown : breakdownDatabean3s) {
            indicatorBreakdown.setCumulative(StringUtils.isBlank(indicatorBreakdown.getCumulative()) ? "0" : NumberUtils.keepPrecision(Double.parseDouble(indicatorBreakdown.getCumulative()) / 10000, 2) /* df.format(Double.parseDouble(indicatorBreakdown.getCumulative())/10000)*/);
            if (indicatorBreakdown.getCurrentMonth().contains(filter.getDate().substring(0, 4))) {
                indicatorBreakdown.setCurrentMonth(indicatorBreakdown.getCurrentMonth().substring(4));
                breakdownDatabean4s.add(indicatorBreakdown);
            } else {
                indicatorBreakdown.setCurrentMonth(indicatorBreakdown.getCurrentMonth().substring(4));
                breakdownDatabeans4.add(indicatorBreakdown);
            }
        }
        List<Map<String, Object>> list32 = new ArrayList<Map<String, Object>>();
        Map<String, Object> map32 = new HashMap<String, Object>();
        Collections.reverse(breakdownDatabean4s);
        Collections.reverse(breakdownDatabeans4);
        map32.put("years", breakdownDatabeans4);
        map32.put("lastYear", breakdownDatabean4s);
        String st = "0";
        if (StringUtils.isNotBlank(breakdown3s.get(0).getExpectedTarget())) {
            st = df.format(Double.parseDouble(breakdown3s.get(0).getExpectedTarget()) / 10000);
        }
        map32.put("expectedTarget", st);
        list32.add(map32);
        return list32;
    }

    public List<CompletionClassificationDatabean> queryByXZValue(
            IndicatorBreakdownFilter filter) {
        List<CompletionClassification> classification2s = classificationService.queryByXZValue(filter);
        if (ObjectUtils.isBlank(classification2s)) {
            return null;
        }
        List<CompletionClassificationDatabean> classificationDatabean2s = new ArrayList<CompletionClassificationDatabean>();
        DecimalFormat df = new DecimalFormat("#.##");
        for (CompletionClassification completionClassification : classification2s) {
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            classification.setActualCompletionValue(completionClassification.getActualCompletionValue());
            //classification.setPlanneValue(completionClassification.getPlanneValue());
            classification.setSpecificIncrease(df.format(Double.parseDouble(completionClassification.getSpecificIncrease())));
            classification.setCategoryDetails(completionClassification.getCategoryDetails());
            //Double doublebs1 = Double.parseDouble(completionClassification.getActualCompletionValue());
			
			/*Double doublebs2 = Double.parseDouble(completionClassification.getPlanneValue());
			Double doublebs3 = doublebs1/doublebs2*100;
			if(doublebs3<DataUtils.warning(filter)){
				classification.setYujz("0");
			}else {
				classification.setYujz("1");
			}
			String st=df.format(doublebs3);
			if("0".equals(completionClassification.getActualCompletionValue())){
				classification.setCompleteAnnual("0");
			}else {
				classification.setCompleteAnnual(st);
			}*/
            classificationDatabean2s.add(classification);
        }
        //Collections.sort(classificationDatabean2s, new ComparatorsUtils());
        return classificationDatabean2s;
    }

    public List<CompletionClassificationDatabean> queryByValue(
            IndicatorBreakdownFilter filter) {
        List<CompletionClassification> classifications = classificationService.queryByValue(filter);
        if (ObjectUtils.isBlank(classifications)) {
            return null;
        }
        List<CompletionClassificationDatabean> classificationDatabeans = new ArrayList<CompletionClassificationDatabean>();
        DecimalFormat df = new DecimalFormat("#.##");
        for (CompletionClassification completionClassification : classifications) {
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            if (completionClassification.getActualCompletionValue().length() > 4 && completionClassification.getPlanneValue().length() > 4) {
                classification.setActualCompletionValue(completionClassification.getActualCompletionValue().substring(0, completionClassification.getActualCompletionValue().length() - 4) +
                        "." + completionClassification.getActualCompletionValue().substring(completionClassification.getActualCompletionValue().length() - 4, completionClassification.getActualCompletionValue().length() - 3));
                classification.setPlanneValue(completionClassification.getPlanneValue().substring(0, completionClassification.getPlanneValue().length() - 4) +
                        "." + completionClassification.getPlanneValue().substring(completionClassification.getPlanneValue().length() - 4, completionClassification.getPlanneValue().length() - 3));
            } else {
                continue;
            }
            Double doublebs1 = Double.parseDouble(completionClassification.getActualCompletionValue());
            Double doublebs2 = Double.parseDouble(completionClassification.getPlanneValue());
            Double doublebs3 = doublebs1 / doublebs2 * 100;
            if (doublebs3 < DataUtils.warning(filter)) {
                classification.setYujz("0");
            } else {
                classification.setYujz("1");
            }
            String st = df.format(doublebs3);

            classification.setCompleteAnnual(st);
            classification.setCategoryDetails(completionClassification.getCategoryDetails());
            classificationDatabeans.add(classification);
        }
        Collections.sort(classificationDatabeans, new ComparatorsUtils());
        List<CompletionClassificationDatabean> classificationDatabeans2 = new ArrayList<CompletionClassificationDatabean>();
        int k = 10;
        if (classificationDatabeans.size() < 10) {
            k = classificationDatabeans.size();
        }
        for (int i = 0; i < k; i++) {
            classificationDatabeans2.add(classificationDatabeans.get(i));
        }
        return classificationDatabeans2;
    }

    public List<Map<String, Object>> queryByHYValue(
            IndicatorBreakdownFilter filter) {
        List<CompletionClassification> classificationa = classificationService.queryMonthValue(filter);
        if (ObjectUtils.isBlank(classificationa)) {
            return null;
        }
        List<CompletionClassification> classification3s = classificationService.queryByHYValue(filter);
        List<CompletionClassificationDatabean> classificationDatabean3s = new ArrayList<CompletionClassificationDatabean>();
        List<CompletionClassificationDatabean> classificationDatabean4s = new ArrayList<CompletionClassificationDatabean>();
        DecimalFormat df = new DecimalFormat("#.##");
        for (CompletionClassification completionClassification : classification3s) {
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            if ("项目投资".equals(completionClassification.getCategoryDetails())) {
                classification.setActualCompletionValue(completionClassification.getActualCompletionValue().substring(0, completionClassification.getActualCompletionValue().length() - 4));
                classification.setPlanneValue(completionClassification.getPlanneValue());
                classification.setCategoryDetails(completionClassification.getCategoryDetails());
                classification.setCompleteAnnual(completionClassification.getCompleteAnnual());
                classification.setCompletionPeriod(completionClassification.getCompletionPeriod().substring(4));
                classificationDatabean3s.add(classification);
            } else {
                classification.setActualCompletionValue(completionClassification.getActualCompletionValue().substring(0, completionClassification.getActualCompletionValue().length() - 4));
                classification.setPlanneValue(completionClassification.getPlanneValue());
                classification.setCategoryDetails(completionClassification.getCategoryDetails());
                classification.setCompleteAnnual(completionClassification.getCompleteAnnual());
                classification.setCompletionPeriod(completionClassification.getCompletionPeriod().substring(4));
                classificationDatabean4s.add(classification);
            }
        }
        List<Map<String, Object>> list2 = new ArrayList<Map<String, Object>>();
        Map<String, Object> map3s = new HashMap<String, Object>();
        map3s.put("xmtz", classificationDatabean3s);
        map3s.put("fdctz", classificationDatabean4s);
        String st = df.format(Double.parseDouble(classification3s.get(0).getPlanneValue()) / 10000);
        map3s.put("expectedTarget", st);
        list2.add(map3s);
        return list2;
    }

    public List<Map<String, Object>> queryByDWValue(
            IndicatorBreakdownFilter filter) {
        List<CompletionClassification> classificationds = classificationService.queryByDWValue(filter);
        if (ObjectUtils.isBlank(classificationds)) {
            return null;
        }
        List<CompletionClassificationDatabean> classificationDatabeands = new ArrayList<CompletionClassificationDatabean>();
        DecimalFormat df = new DecimalFormat("#.##");
        for (CompletionClassification completionClassification : classificationds) {
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            classification.setActualCompletionValue(completionClassification.getActualCompletionValue());
            classification.setPlanneValue(completionClassification.getPlanneValue());
            Double doubleds1 = Double.parseDouble(completionClassification.getActualCompletionValue());
            Double doubleds2 = Double.parseDouble(completionClassification.getPlanneValue());
            if (doubleds2 < 5000) {
                continue;
            }
            Double doubleds3 = doubleds1 / doubleds2 * 100;
            if (doubleds3 < DataUtils.warning(filter)) {
                classification.setYujz("0");
            } else {
                classification.setYujz("1");
            }
            if (doubleds3 == 0) {
                classification.setCompleteAnnual(Double.toString(doubleds3));
            } else {
                String st = df.format(doubleds3);
                classification.setCompleteAnnual(st);
            }
            classification.setCategoryDetails(completionClassification.getCategoryDetails());
            classificationDatabeands.add(classification);
        }
        Collections.sort(classificationDatabeands, Comparators.getComparator());
        List<CompletionClassificationDatabean> classificationDatabeands2 = new ArrayList<CompletionClassificationDatabean>();
        List<CompletionClassificationDatabean> classificationDatabeands3 = new ArrayList<CompletionClassificationDatabean>();
        for (int i = 0; i < classificationDatabeands.size(); i++) {
            int y = classificationDatabeands.size();
            if (i == 6) {
                break;
            }
            classificationDatabeands2.add(classificationDatabeands.get(i));
            classificationDatabeands3.add(classificationDatabeands.get(y - i - 1));
        }
        List<Map<String, Object>> listd2 = new ArrayList<Map<String, Object>>();
        Map<String, Object> mapd3s = new HashMap<String, Object>();
        mapd3s.put("qliu", classificationDatabeands2);
        mapd3s.put("mliu", classificationDatabeands3);
        listd2.add(mapd3s);
        return listd2;
    }

    public Map<String, Object> queryLastThiValue(IndicatorBreakdownFilter filter) {
        TertiaryIndustry industry = tertiaryIndustryService.getById(filter.getIndustryId());
        if (IndustryNameUtils.ProOneIndexId.equals(filter.getIndustryId()) && "行业".equals(filter.getBm())) {
            filter.setDate("201601-12");
        }
        List<CompletionClassification> classifications = classificationService.queryByThiValue(filter);
        List<CompletionClassificationDatabean> classificationDatabeans = new ArrayList<CompletionClassificationDatabean>();
//		List<CompletionClassificationDatabean> classificationDatabeans2 = new ArrayList<CompletionClassificationDatabean>(); 
        DecimalFormat df = new DecimalFormat("#.##");
        for (CompletionClassification completionClassification : classifications) {
            List<CompletionClassificationDatabean> databeans = new ArrayList<CompletionClassificationDatabean>();
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            if (StringUtils.isNotBlank(completionClassification.getPlanneValue())) {
                classification.setRightValue(df.format(Double.parseDouble(completionClassification.getPlanneValue())));
            } else {
                classification.setRightValue("待填充");
            }
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            if (StringUtils.isNotBlank(completionClassification.getActualCompletionValue())) {
                classification.setRightValue(df.format(Double.parseDouble(completionClassification.getActualCompletionValue())));
            } else {
                classification.setRightValue("待填充");
            }
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            if (StringUtils.isNotBlank(completionClassification.getPlanneValue()) && StringUtils.isNotBlank(completionClassification.getActualCompletionValue())) {
                Double double1 = Double.parseDouble(completionClassification.getActualCompletionValue());
                Double double2 = Double.parseDouble(completionClassification.getPlanneValue());
                Double double3 = double1 / double2 * 100;
                if (double3 > 1) {
                    String st = df.format(double1 / double2 * 100);
                    classification.setRightValue(st);
                } else {
                    classification.setRightValue("0");
                }
            } else {
                classification.setRightValue("待填充");
            }
            databeans.add(classification);
            classification = new CompletionClassificationDatabean();
            classification.setLeftValue(completionClassification.getCategoryDetails());
            classification.setRightdata(databeans);
            classificationDatabeans.add(classification);
//			classificationDatabeans2.add(classification2);
        }
        Map<String, Object> map = new HashMap<String, Object>();
        List<Map<String, String>> secTitle = new ArrayList<Map<String, String>>();
        Map<String, String> map2 = new HashMap<String, String>();
        map.put("title", industry.getIndicatorName() + "按" + filter.getBm() + "分类完成情况");
        map.put("firTitle", filter.getBm());
        String oneTitle = "年计划数(万元)";
        String twoTitle = "完成数(万元)";
        String thiTitle = "完成比率(%)";
        map2.put("column", oneTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", twoTitle);
        secTitle.add(map2);
        map2 = new HashMap<String, String>();
        map2.put("column", thiTitle);
        secTitle.add(map2);
        map.put("secTitle", secTitle);
//		map.put("left", classificationDatabeans2);
        map.put("data", classificationDatabeans);
        return map;
    }

    public List<CompletionClassificationDatabean> queryXMValue(
            IndicatorBreakdownFilter filter) {
        List<CompletionClassification> classificationds = classificationService.queryByValue(filter);
        if (ObjectUtils.isBlank(classificationds)) {
            return null;
        }
//		filter.setDate(DateForIndUtils.getNextMonthValueDate(filter.getDate(), -12));
//		List<CompletionClassification> classificationd2s = classificationService.queryByDWValue(filter);
        int k = 0;
        List<CompletionClassificationDatabean> classificationDatabeands = new ArrayList<CompletionClassificationDatabean>();
        for (int i = filter.getPage() * 20; i < classificationds.size(); i++) {
            if (k == 20) {
                break;
            }
//			for (CompletionClassification completionClassification2 : classificationd2s) {
//				if(completionClassification.getCategoryDetails().equals(completionClassification2.getCategoryDetails())){
            CompletionClassificationDatabean classification = new CompletionClassificationDatabean();
            DecimalFormat df = new DecimalFormat("#.##");
            classification.setActualCompletionValue(df.format(Double.parseDouble(classificationds.get(i).getActualCompletionValue())));
            classification.setPlanneValue(df.format(Double.parseDouble(classificationds.get(i).getPlanneValue())));
            classification.setCategoryDetails(classificationds.get(i).getCategoryDetails());
//					classification.setCompleteAnnual(df.format(Double.parseDouble(classificationds.get(i).getCompleteAnnual())));
            if (Double.parseDouble(classificationds.get(i).getActualCompletionValue()) == 0 || Double.parseDouble(classificationds.get(i).getPlanneValue()) == 0) {
                classification.setCompleteAnnual("0");
            } else {
                String st = df.format(Double.parseDouble(classificationds.get(i).getActualCompletionValue()) / Double.parseDouble(classificationds.get(i).getPlanneValue()) * 100);
                classification.setCompleteAnnual(st);
            }

            classificationDatabeands.add(classification);
            k++;
//				}
//			}
        }
        return classificationDatabeands;
    }

}
